<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>小米 Logo 过渡动画</title>
  <style>
    .header-logo {
      position: relative;
    }

    /* 设置 logo 样式 */
    .header-logo .logo {
      display: block;
      width: 55px;
      height: 55px;
      background-color: orange;
      color: #fff;
      text-decoration: none;
      text-indent: -9999em;
    }

    .header-logo .logo::before,
    .header-logo .logo::after {
      position: absolute;
      content: '';
      top: 0;
      width: 55px;
      height: 55px;
      transition: all 0.5s;
    }

    .header-logo .logo::before {
      left: 0;
      background: url(./images/mi-logo.png) no-repeat center;
    }

    .header-logo .logo::after {
      left: 55px;
      background: url(./images/mi-home.png) no-repeat center;
    }

    .header-logo:hover .logo::before {
      left: -55px;
    }

    .header-logo:hover .logo::after {
      left: 0px;
    }
  </style>
</head>

<body>
  <div class="header-logo">
    <a href="#" class="logo" title="小米官网">小米官网</a>
  </div>
</body>

</html>